<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="css/add.css"/>
    <script type="text/javascript" src="js/jquery.1.9.1.js" ></script>
    <script type="text/javascript" src="js/layer.js" ></script>
    <link rel="stylesheet" type="text/css" href="css/layer.css"/>
    <script type="text/javascript" src="js/iScroll.js" ></script>
    <script type="text/javascript" src="js/Mdate.js" ></script>
	<link rel="stylesheet" href="css/Mdate.css" />
	<script type="text/javascript" src="js/rem.js" ></script>
    <title>新增采购订单</title>
</head>
<body>
<form id="form2" action="" enctype="multipart/form-data"  method="post">
<ul class="order_money" style="padding: 0 0.3rem;background: #fff;">
    <li>
    		<span class="num">编号</span>
    		<input type="text" name="" id="week" value="" placeholder="请输入订单编号" />
    </li>
    <li id="dateShowBtn">
    		<span class="time">单据日期</span>
    		<span class="jt"></span>
    		<input type="text" disabled="disabled" id="dateSelectorOne"  value="" placeholder="必填" />
    </li>
    <li>
    		<span class="chang">供应商</span>
    		<span class="jt"></span>
    		<select class="session">
    			<option value="0">必填</option>
    			<option value="1">供应商1</option>
    			<option value="2">供应商2</option>
    			<option value="3">供应商3</option>
    		</select>
    </li>
    <li>
    		<span class="cg">采购人员</span>
    		<span class="jt"></span>
    		<select class="caigou">
    			<option value="0">必填</option>
    			<option value="1">采购1</option>
    			<option value="2">采购2</option>
    			<option value="3">采购3</option>
    		</select>
    </li>
</ul>
<ul class="product">
	<li>产品信息<div class="jia"><img src="img/jia.png"/></div></li>
</ul>
<ul class="productinfo">
	<li>
		<div class="infoleft"><img src="img/product.png"/></div>
		<div class="inforight">
			<p>小学生绘本课堂  年级阅读  二年级</p>
			<p class="infop2">仓库：北京仓库</p>
			<p class="infop3">¥50.00×100本</p>
		</div>
	</li>
	<li>
		<div class="infoleft"><img src="img/product.png"/></div>
		<div class="inforight">
			<p>小学生绘本课堂  年级阅读  二年级</p>
			<p class="infop2">仓库：北京仓库</p>
			<p class="infop3">¥50.00×100本</p>
		</div>
	</li>
	<li>
		<div class="lastleft">
			<p>3000</p>
			<p>数量合计</p>
		</div>
		<div class="lastright">
			<p class="infop3">¥50,000.00</p>
			<p>金额合计</p>
		</div>
	</li>
</ul>
<ul class="beizhu" style="margin-bottom: 1rem;">
	<li>
    		<span class="money">其他金额</span>
    		<input type="number" name="" id="money" value="" placeholder="0.00" />
    </li>
	<li style="height: 2.5rem;">
		<p class="title">单据备注</p>
        <textarea name="" value="" ></textarea>
    </li>
</ul>
<div class="button">
		<a href="#"><div class="close">保存草稿</div></a>
		<div class="continue"><input class="pay" type="submit" name="" id="" value="提交审批" /></div>
</div>

</form>
<script>//提交表单
$(function(){
	$('.pay').click(function(){
		var num = $('#week').val();
		var datetime = $('#dateSelectorOne').val();
		var supplier = $('.session').val();
		var caigou = $('.caigou').val();
		var money = $('#money').val();
		var txt = $('textarea').val();
		if(num == ''||num == null){
				layer.open({
				content:'请输入订单编号' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(datetime == ''||datetime == null){
				layer.open({
				content:'请选择单据日期' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(supplier == 0){
				layer.open({
				content:'请选择供应商' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(caigou == 0){
				layer.open({
				content:'请选择采购人员' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(money == ''||money == null){
				layer.open({
				content:'请输入金额' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(txt == ''||txt == null){
				layer.open({
				content:'请填写备注' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		$.ajax({
		  type: 'post',
		  url:"" ,
		  data:{num:num,datetime:datetime,supplier:supplier,caigou:caigou,money:money,txt:txt},
		  dataType: "json",
		  success: function(data){
		    window.location.href = "cglist.html";
		      }
		 });
	 });
});
</script>
<script>//字体变化
	$('#week').keyup(function(){
		var week = $('#week').val();
		if(week != ''){
			$('.num').css('font-size','0.2rem');
		}else{
			$('.num').css('font-size','0.28rem');
		}
	});
	$('.session').change(function(){
		var session = $('.session').val();
		if(session != 0){
			$('.chang').css('font-size','0.2rem');
		}else{
			$('.chang').css('font-size','0.28rem');
		}
	});
	$('.caigou').change(function(){
		var caigou = $('.caigou').val();
		if(caigou != 0){
			$('.cg').css('font-size','0.2rem');
		}else{
			$('.cg').css('font-size','0.28rem');
		}
	});
	$('#money').keyup(function(){
		var money = $('#money').val();
		if(money != ''){
			$('.money').css('font-size','0.2rem');
		}else{
			$('.money').css('font-size','0.28rem');
		}
	});
	$('textarea').keyup(function(){
		var textarea = $('textarea').val();
		if(textarea != ''){
			$('.title').css('font-size','0.2rem');
		}else{
			$('.title').css('font-size','0.28rem');
		}
	});
</script>
<script>//单据日期
new Mdate("dateShowBtn", {
    //"dateShowBtn"为你点击触发Mdate的id，必填项
    acceptId: "dateSelectorOne",
    //此项为你要显示选择后的日期的input，不填写默认为上一行的"dateShowBtn"
    beginYear: "2010",
    //此项为Mdate的初始年份，不填写默认为2000
    beginMonth: "1",
    //此项为Mdate的初始月份，不填写默认为1
    beginDay: "1",
    //此项为Mdate的初始日期，不填写默认为1
    endYear: "2050",
    //此项为Mdate的结束年份，不填写默认为当年
    endMonth: "12",
    //此项为Mdate的结束月份，不填写默认为当月
    endDay: "31",
    //此项为Mdate的结束日期，不填写默认为当天
    format: "-"
    //此项为Mdate需要显示的格式，可填写"/"或"-"或".",不填写默认为年月日
})
</script>
</body>
</html>
